LauncherTest = TestCase("Test Launcher");

LauncherTest.prototype.testsingleLauncher = function(){
	var timingInfo = [{
		t : 1.0,
		y : 4.905
	}];
	var physicsInfo = {
		gravity : 9.81
	};
	launcher = new Launcher(timingInfo, physicsInfo);
	p = launcher.calculate(5);
	assertEquals(0, p[0].startTime);
	assertEquals(5, p[0].x);
};

LauncherTest.prototype.testsingleLauncher2 = function(){
	var timingInfo = [{
		t : 6.5,
		y : 122.625
	}];
	var physicsInfo = {
		gravity : 9.81
	};
	launcher = new Launcher(timingInfo, physicsInfo);
	p = launcher.calculate();
	assertEquals(1.5, p[0].startTime);
};

LauncherTest.prototype.testsingleLauncher3 = function(){
	var timingInfo = [{
		t : 6.5,
		y : 122.625
	}];
	var physicsInfo = {
		gravity : 9.81
	};
	launcher = new Launcher(timingInfo, physicsInfo);
	p = launcher.calculate();
	assertClose(122.165, p[0].getYPosition(6.5));
};

LauncherTest.prototype.testsingleLauncher3 = function(){
	var timingInfo = [{
		t : 6.5,
		y : 122.625
	}];
	var physicsInfo = {
		gravity : 9.81
	};
	launcher = new Launcher(timingInfo, physicsInfo);
	p = launcher.calculate();
	assertClose(122.165, p[0].getYPosition(6.5));
	assertEquals(p, launcher.projectiles);
};

function assertClose(val1, val2) {
	if(Math.abs(val1 - val2) > 0.5)
		fail();
}

LauncherTest.prototype.testMultiLauncher = function(){
	var timingInfo = [{
		t : 1.0,
		y : 4.905
	},{
		t : 6.5,
		y : 122.625
	}];
	var physicsInfo = {
		gravity : 9.81
	};
	launcher = new Launcher(timingInfo, physicsInfo);
	p = launcher.calculate();
	assertEquals(0, p[0].startTime);
	assertEquals(1.5,p[1].startTime);
};